home *** CD-ROM | disk | FTP | other *** search
- /*
- File: TMapView.h
-
- Contains: Class implementing a map location selector
-
- Written by: Arno Gourdol
-
- Copyright: Copyright 1996 by Apple Computer, Inc., all rights reserved.
-
- */
-
- #pragma once
-
- #ifndef __TMAPVIEW__
- #define __TMAPVIEW__
-
- #include "TDrawContext.h"
- #include "TBitmap.h"
-
-
-
- typedef struct RgnLResourceEntry
- {
- short pictureID;
- short value;
- } RegionValueRec;
-
-
- struct RgnLResource
- {
- UInt16 regionCount;
- RgnLResourceEntry regions[1];
- };
-
- typedef struct RgnLResource RgnLResource, **RgnLResourceHandle;
-
-
-
- class TMapView
- {
- public:
- // constructor
- TMapView(SInt16 mapID, SInt16 hiliteMapID, SInt16 colorMapID,
- SInt16 colorHiliteMapID, SInt16 regionListID);
-
- // destructor
- ~TMapView();
-
- // events
- void Draw(const TDrawContext& drawContext, const CRect& frame) const;
- void MouseDown(CRect bounds);
- void Pulse(void);
-
- // getters
- SInt16 FindRegion(CPoint location);
- SInt16 GetValue(void);
-
- // setters
- void SetValue(SInt16 value);
-
- private:
- TBitmap* fColorMap; // Bitmap of the regular map
- TBitmap* fColorHilitedMap; // Bitmap of the hilited map
- TBitmap* fMap; // Bitmap of the regular map (B&W)
- TBitmap* fHilitedMap; // Bitmap of the hilited map (B&W)
-
- SInt16 fSelectedRegion; // Index in fRegions or -1
-
- UInt16 fNumRegions; // Number of regions
- struct Region { RgnHandle region; SInt16 value; SInt16 pictureID; } *fRegions;
- };
-
-
- #endif
-